import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '姓名',
    align: 'center',
    dataIndex: 'name',
  },
  {
    title: '身份证',
    align: 'center',
    dataIndex: 'idcard',
  },
  {
    title: '手机',
    align: 'center',
    dataIndex: 'phone',
  },
  {
    title: '微信openid',
    align: 'center',
    dataIndex: 'openid',
  },
  {
    title: '微信unionid',
    align: 'center',
    dataIndex: 'unionid',
  },
  {
    title: '创建时间',
    align: 'center',
    dataIndex: 'createTime',
  },
  {
    title: '更新时间',
    align: 'center',
    dataIndex: 'updateTime',
  },
  {
    title: '是否有效',
    align: 'center',
    dataIndex: 'status_dictText',
  },
  {
    title: '性别',
    align: 'center',
    dataIndex: 'sex_dictText',
  },
  {
    title: '头像',
    align: 'center',
    dataIndex: 'avatar',
    customRender: render.renderImage,
  },
  {
    title: '地区',
    align: 'center',
    dataIndex: 'area',
  },
  {
    title: '地区名称',
    align: 'center',
    dataIndex: 'areaName',
  },
  {
    title: '详细地址',
    align: 'center',
    dataIndex: 'address',
  },
  {
    title: '默认医院',
    align: 'center',
    dataIndex: 'defaultHospital',
  },
  {
    title: '默认医院名称',
    align: 'center',
    dataIndex: 'defaultHospitalName',
  },
  {
    title: '等级',
    align: 'center',
    dataIndex: 'level',
  },
  {
    title: '是否实名',
    align: 'center',
    dataIndex: 'isVerify_dictText',
    width: 150,
  },
  {
    title: '端口',
    align: 'center',
    dataIndex: 'port',
    customRender: ({ text }) => {
      if (text === 0 || text === '0') return '客户端';
      if (text === 1 || text === '1') return '医护端';
      return text;
    },
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '姓名',
    field: 'name',
    component: 'JInput', //模糊查询
    //colProps: {span: 6},
  },
  {
    label: '身份证',
    field: 'idcard',
    component: 'JInput',
    //colProps: {span: 6},
  },
  {
    label: '手机',
    field: 'phone',
    component: 'JInput',
    //colProps: {span: 6},
  },
  {
    label: '微信openid',
    field: 'openid',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: '微信unionid',
    field: 'unionid',
    component: 'JInput',
    //colProps: {span: 6},
  },
  {
    label: '是否有效',
    field: 'status',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'valid_status',
    },
    //colProps: {span: 6},
  },
  {
    label: '地区',
    field: 'area',
    component: 'JInput',
    //colProps: {span: 6},
  },
  {
    label: '默认医院名称',
    field: 'defaultHospitalName',
    component: 'JInput',
    //colProps: {span: 6},
  },
  {
    label: '等级',
    field: 'level',
    component: 'JInput',
    //colProps: {span: 6},
  },
  {
    label: '是否实名',
    field: 'isVerify',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'yes_no',
    },
    //colProps: {span: 6},
  },
  {
    label: '端口',
    field: 'port',
    component: 'Select',
    componentProps: {
      options: [
        { label: '客户端', value: '0' },
        { label: '医护端', value: '1' },
      ],
    },
    //colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '姓名',
    field: 'name',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入姓名!' },
      ];
    },
  },
  {
    label: '身份证',
    field: 'idcard',
    component: 'Input',
  },
  {
    label: '手机',
    field: 'phone',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入手机!' },
      ];
    },
  },
  {
    label: '微信openid',
    field: 'openid',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入微信openid!' },
      ];
    },
  },
  {
    label: '微信unionid',
    field: 'unionid',
    component: 'Input',
  },
  {
    label: '创建时间',
    field: 'createTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入创建时间!' },
      ];
    },
  },
  {
    label: '更新时间',
    field: 'updateTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
  },
  {
    label: '是否有效',
    field: 'status',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "valid_status"
    },
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入是否有效!' },
      ];
    },
  },
  {
    label: '性别',
    field: 'sex',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "nurse_sex"
    },
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入性别!' },
      ];
    },
  },
  {
    label: '头像',
    field: 'avatar',
    component: 'JImageUpload',
    componentProps: {
    },
  },
  {
    label: '地区',
    field: 'area',
    component: 'Input',
  },
  {
    label: '地区名称',
    field: 'areaName',
    component: 'Input',
  },
  {
    label: '详细地址',
    field: 'address',
    component: 'Input',
  },
  {
    label: '默认医院',
    field: 'defaultHospital',
    component: 'Input',
  },
  {
    label: '默认医院名称',
    field: 'defaultHospitalName',
    component: 'Input',
  },
  {
    label: '等级',
    field: 'level',
    component: 'Input',
  },
  {
    label: '是否实名',
    field: 'isVerify',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'yes_no',
    },
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
];

//子表列表数据
export const nurseUserFamilyColumns: BasicColumn[] = [
  {
    title: '姓名',
    align: "center",
    dataIndex: 'name'
  },
  {
    title: '身份证',
    align: "center",
    dataIndex: 'idcard'
  },
  {
    title: '手机',
    align: "center",
    dataIndex: 'phone'
  },
  {
    title: '性别',
    align: "center",
    dataIndex: 'sex_dictText'
  },
  {
    title: '年龄',
    align: "center",
    dataIndex: 'age'
  },
  {
    title: '年龄单位',
    align: "center",
    dataIndex: 'ageUnit'
  },
  {
    title: '状态',
    align: "center",
    dataIndex: 'status_dictText'
  },
  {
    title: '关联userid',
    align: "center",
    dataIndex: 'userId'
  },
  {
    title: '创建时间',
    align: "center",
    dataIndex: 'createTime'
  },
  {
    title: '更新时间',
    align: "center",
    dataIndex: 'updateTime'
  },
  {
    title: '关系',
    align: "center",
    dataIndex: 'relation'
  },
  {
    title: '关系名称',
    align: "center",
    dataIndex: 'relationName'
  },
  {
    title: '能否自理',
    align: "center",
    dataIndex: 'isSelf'
  },
  {
    title: '地区',
    align: "center",
    dataIndex: 'area'
  },
  {
    title: '地区名称',
    align: "center",
    dataIndex: 'areaName'
  },
  {
    title: '详细地址',
    align: "center",
    dataIndex: 'address'
  },
  {
    title: '医院',
    align: "center",
    dataIndex: 'hospital'
  },
  {
    title: '医院名称',
    align: "center",
    dataIndex: 'hospitalName'
  },
  {
    title: '科室',
    align: "center",
    dataIndex: 'dept'
  },
  {
    title: '科室名称',
    align: "center",
    dataIndex: 'deptName'
  },
  {
    title: '床号',
    align: "center",
    dataIndex: 'bed'
  },
  {
    title: '床号名称',
    align: "center",
    dataIndex: 'bedName'
  },
  {
    title: '病历号',
    align: "center",
    dataIndex: 'record'
  },
];
//子表表单数据
export const nurseUserFamilyFormSchema: FormSchema[] = [
  // TODO 子表隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
  {
    label: '姓名',
    field: 'name',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入姓名!' },
      ];
    },
  },
  {
    label: '身份证',
    field: 'idcard',
    component: 'Input',
  },
  {
    label: '手机',
    field: 'phone',
    component: 'Input',
  },
  {
    label: '性别',
    field: 'sex',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "nurse_sex"
    },
  },
  {
    label: '年龄',
    field: 'age',
    component: 'Input',
  },
  {
    label: '年龄单位',
    field: 'ageUnit',
    component: 'Input',
  },
  {
    label: '状态',
    field: 'status',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "nurse_status"
    },
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入状态!' },
      ];
    },
  },
  {
    label: '关联userid',
    field: 'userId',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入关联userid!' },
      ];
    },
  },
  {
    label: '创建时间',
    field: 'createTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入创建时间!' },
      ];
    },
  },
  {
    label: '更新时间',
    field: 'updateTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
  },
  {
    label: '关系',
    field: 'relation',
    component: 'Input',
  },
  {
    label: '关系名称',
    field: 'relationName',
    component: 'Input',
  },
  {
    label: '能否自理',
    field: 'isSelf',
    component: 'Input',
  },
  {
    label: '地区',
    field: 'area',
    component: 'Input',
  },
  {
    label: '地区名称',
    field: 'areaName',
    component: 'Input',
  },
  {
    label: '详细地址',
    field: 'address',
    component: 'Input',
  },
  {
    label: '医院',
    field: 'hospital',
    component: 'Input',
  },
  {
    label: '医院名称',
    field: 'hospitalName',
    component: 'Input',
  },
  {
    label: '科室',
    field: 'dept',
    component: 'Input',
  },
  {
    label: '科室名称',
    field: 'deptName',
    component: 'Input',
  },
  {
    label: '床号',
    field: 'bed',
    component: 'Input',
  },
  {
    label: '床号名称',
    field: 'bedName',
    component: 'Input',
  },
  {
    label: '病历号',
    field: 'record',
    component: 'Input',
  },
];
//子表列表数据
export const nurseUserAddrColumns: BasicColumn[] = [
  {
    title: '用户ID',
    align: "center",
    dataIndex: 'userId'
  },
  {
    title: '联系人',
    align: "center",
    dataIndex: 'name'
  },
  {
    title: '联系电话',
    align: "center",
    dataIndex: 'phone'
  },
  {
    title: '地区',
    align: "center",
    dataIndex: 'area'
  },
  {
    title: '地区名称',
    align: "center",
    dataIndex: 'areaName'
  },
  {
    title: '详细地址',
    align: "center",
    dataIndex: 'address'
  },
  {
    title: '医院',
    align: "center",
    dataIndex: 'hospital'
  },
  {
    title: '医院名称',
    align: "center",
    dataIndex: 'hospitalName'
  },
  {
    title: '科室',
    align: "center",
    dataIndex: 'dept'
  },
  {
    title: '科室名称',
    align: "center",
    dataIndex: 'deptName'
  },
  {
    title: '床号',
    align: "center",
    dataIndex: 'bed'
  },
  {
    title: '床号名称',
    align: "center",
    dataIndex: 'bedName'
  },
  {
    title: '病历号',
    align: "center",
    dataIndex: 'record'
  },
  {
    title: '默认地址',
    align: "center",
    dataIndex: 'isDefault'
  },
  {
   title: '经度',
   align:"center",
   dataIndex: 'longitude'
  },
  {
   title: '纬度',
   align:"center",
   dataIndex: 'latitude'
  },
];
//子表表单数据
export const nurseUserAddrFormSchema: FormSchema[] = [
  // TODO 子表隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
  {
    label: '用户ID',
    field: 'userId',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入用户ID!' },
      ];
    },
  },
  {
    label: '联系人',
    field: 'name',
    component: 'Input',
  },
  {
    label: '联系电话',
    field: 'phone',
    component: 'Input',
  },
  {
    label: '地区',
    field: 'area',
    component: 'Input',
  },
  {
    label: '地区名称',
    field: 'areaName',
    component: 'Input',
  },
  {
    label: '详细地址',
    field: 'address',
    component: 'Input',
  },
  {
    label: '医院',
    field: 'hospital',
    component: 'Input',
  },
  {
    label: '医院名称',
    field: 'hospitalName',
    component: 'Input',
  },
  {
    label: '科室',
    field: 'dept',
    component: 'Input',
  },
  {
    label: '科室名称',
    field: 'deptName',
    component: 'Input',
  },
  {
    label: '床号',
    field: 'bed',
    component: 'Input',
  },
  {
    label: '床号名称',
    field: 'bedName',
    component: 'Input',
  },
  {
    label: '病历号',
    field: 'record',
    component: 'Input',
  },
  {
    label: '默认地址',
    field: 'isDefault',
    component: 'Input',
  },
  {
    label: '经度',
    field: 'longitude',
    component: 'Input',
  },
  {
    label: '纬度',
    field: 'latitude',
    component: 'Input',
  },
];
//子表列表数据
export const nurseUserIntegralColumns: BasicColumn[] = [
  {
    title: '开始时间',
    align: "center",
    dataIndex: 'beginTime'
  },
  {
    title: '结束时间',
    align: "center",
    dataIndex: 'endTime'
  },
  {
    title: '积分金额',
    align: "center",
    dataIndex: 'amt'
  },
  {
    title: '状态',
    align: "center",
    dataIndex: 'status_dictText'
  },
  {
    title: '订单ID',
    align: "center",
    dataIndex: 'orderId'
  },
  {
    title: '用户ID',
    align: "center",
    dataIndex: 'userId'
  },
  {
    title: '创建时间',
    align: "center",
    dataIndex: 'createTime'
  },
  {
    title: '更新时间',
    align: "center",
    dataIndex: 'updateTime'
  },
  {
    title: '创建人',
    align: "center",
    dataIndex: 'createBy'
  },
  {
    title: '更新人',
    align: "center",
    dataIndex: 'updateBy'
  },
];
//子表表单数据
export const nurseUserIntegralFormSchema: FormSchema[] = [
  // TODO 子表隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
  {
    label: '开始时间',
    field: 'beginTime',
    component: 'DatePicker',
    componentProps: {
      showTime: false,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入开始时间!' },
      ];
    },
  },
  {
    label: '结束时间',
    field: 'endTime',
    component: 'DatePicker',
    componentProps: {
      showTime: false,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入结束时间!' },
      ];
    },
  },
  {
    label: '积分金额',
    field: 'amt',
    component: 'InputNumber',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入积分金额!' },
      ];
    },
  },
  {
    label: '状态',
    field: 'status',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "valid_status"
    },
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入状态!' },
      ];
    },
  },
  {
    label: '用户ID',
    field: 'userId',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入用户ID!' },
      ];
    },
  },
  {
    label: '订单ID',
    field: 'orderId',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入订单ID!' },
      ];
    },
  },
];
//子表列表数据
export const nurseUserSpecialColumns: BasicColumn[] = [
  {
    title: '优惠劵名称',
    align: "center",
    dataIndex: 'name'
  },
  {
    title: '优惠劵ID',
    align: "center",
    dataIndex: 'promotionalId'
  },
  {
    title: '商品ID',
    align: "center",
    dataIndex: 'goodsId'
  },
  {
    title: '商品名称',
    align: "center",
    dataIndex: 'goodsName'
  },
  {
    title: '开始时间',
    align: "center",
    dataIndex: 'beginTime'
  },
  {
    title: '结束时间',
    align: "center",
    dataIndex: 'endTime'
  },
  {
    title: '优惠劵类型',
    align: "center",
    dataIndex: 'type_dictText'
  },
  {
    title: '金额',
    align: "center",
    dataIndex: 'amt'
  },
  {
    title: '满减金额',
    align: "center",
    dataIndex: 'discount'
  },
  {
    title: '描述',
    align: "center",
    dataIndex: 'description'
  },
  {
    title: '状态',
    align: "center",
    dataIndex: 'status_dictText'
  },
  {
    title: '用户ID',
    align: "center",
    dataIndex: 'userId'
  },
  {
    title: '创建时间',
    align: "center",
    dataIndex: 'createTime'
  },
  {
    title: '更新时间',
    align: "center",
    dataIndex: 'updateTime'
  },
  {
    title: '创建人',
    align: "center",
    dataIndex: 'createBy'
  },
  {
    title: '更新人',
    align: "center",
    dataIndex: 'updateBy'
  },
  {
    title: 'pid',
    align: "center",
    dataIndex: 'pid',
  },
];
//子表表单数据
export const nurseUserSpecialFormSchema: FormSchema[] = [
  // TODO 子表隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
  {
    label: '优惠劵名称',
    field: 'name',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入优惠劵名称!' },
      ];
    },
  },
  {
    label: '优惠劵ID',
    field: "promotionalId",
    component: 'Input',
  },
  {
    label: '商品ID',
    field: 'goodsId',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入商品ID!' },
      ];
    },
  },
  {
    label: '商品名称',
    field: 'goodsName',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入商品名称!' },
      ];
    },
  },
  {
    label: '开始时间',
    field: 'beginTime',
    component: 'DatePicker',
    componentProps: {
      showTime: false,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入开始时间!' },
      ];
    },
  },
  {
    label: '结束时间',
    field: 'endTime',
    component: 'DatePicker',
    componentProps: {
      showTime: false,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入结束时间!' },
      ];
    },
  },
  {
    label: '优惠劵类型',
    field: 'type',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "nurse_special_type"
    },
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入优惠劵类型!' },
      ];
    },
  },
  {
    label: '金额',
    field: 'amt',
    component: 'InputNumber',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入金额!' },
      ];
    },
  },
  {
    label: '满减金额',
    field: 'discount',
    component: 'InputNumber',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入满减金额!' },
      ];
    },
  },
  {
    label: '描述',
    field: 'description',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入描述!' },
      ];
    },
  },
  {
    label: '状态',
    field: 'status',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: "valid_status"
    },
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入状态!' },
      ];
    },
  },
  {
    label: '用户ID',
    field: 'userId',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入用户ID!' },
      ];
    },
  },
  {
    label: 'pid',
    field: 'pid',
    component: 'Input',
  },
];

// 高级查询数据
export const superQuerySchema = {
  name: { title: '姓名', order: 0, view: 'text', type: 'string', },
  idcard: { title: '身份证', order: 1, view: 'text', type: 'string', },
  phone: { title: '手机', order: 2, view: 'text', type: 'string', },
  openid: { title: '微信openid', order: 3, view: 'text', type: 'string', },
  unionid: { title: '微信unionid', order: 4, view: 'text', type: 'string', },
  createTime: { title: '创建时间', order: 5, view: 'datetime', type: 'string', },
  updateTime: { title: '更新时间', order: 6, view: 'datetime', type: 'string', },
  status: { title: '是否有效', order: 7, view: 'radio', type: 'string', },
  sex: { title: '性别', order: 8, view: 'radio', type: 'string', },
  avatar: { title: '头像', order: 9, view: 'image', type: 'string', },
  area: { title: '地区', order: 10, view: 'text', type: 'string', },
  areaName: { title: '地区名称', order: 11, view: 'text', type: 'string', },
  address: { title: '详细地址', order: 12, view: 'text', type: 'string', },
  defaultHospital: { title: '默认医院', order: 13, view: 'text', type: 'string', },
  defaultHospitalName: { title: '默认医院名称', order: 14, view: 'text', type: 'string', },
  isVerify: { title: '是否实名', order: 15, view: 'radio', type: 'string', },
  port: { title: '端口', order: 16, view: 'radio', type: 'string', },
};
